package com.admin.kotlintest

import android.graphics.Color
import android.support.v7.app.AppCompatActivity
import android.os.Bundle

import kotlinx.android.synthetic.main.activity_main.*
import org.jetbrains.anko.startActivity
import org.jetbrains.anko.toast

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        btn_text_styles.setOnClickListener {
            btnTextStyle()
        }

        btn_click.setOnClickListener {
            toast("i am toast")
        }

        btn_adapter.setOnClickListener {
            startActivity<ListviewActivity>()
        }
    }

    //修改字体颜色以及背景
    private fun btnTextStyle(){
        btn_text_styles.textSize=18f
        btn_text_styles.setBackgroundColor(Color.BLACK)
        btn_text_styles.setTextColor(Color.WHITE)
    }


}
